import request from '@/utils/request'
// 登录
export const sysUser = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}
// 新增
export const sysUserPost = (data) => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 删除
export const sysUserDel = (id) => {
  return request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}
// 导入
export const sysUserBatch = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
// 更新基本信息
export const sysUserPut = (data) => {
  return request({
    url: '/sys/user/' + data.id,
    method: 'put',
    data
  })
}
// 获取个人信息
export const employeesPersonalInfo = (id) => {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}
// 更新个人信息
export const employeesPersonalInfoPut = (data) => {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}
// 获取岗位信息
export const employeesJobs = (id) => {
  return request({
    url: `/employees/${id}/jobs`
  })
}
// 更新岗位信息
export const employeesJobsPut = (data) => {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
// 给员工分配角色
export const sysUserAssignRoles = (id, roleIds) => {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put',
    data: {
      id,
      roleIds
    }
  })
}
